using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ihongma.Common;

namespace ihongma.Web.admin.dialog
{
    public partial class dialog_print : Web.UI.ManagePage
    {
        private string order_no = string.Empty;
        protected Model.orders model = new Model.orders();
        protected Model.manager adminModel = new Model.manager();
        protected List<Model.order_goods> modelgoods = new List<Model.order_goods>();
        protected int id = 0;
        protected Model.user_address modeladdress = new Model.user_address();
        protected void Page_Load(object sender, EventArgs e)
        {
            order_no = DTRequest.GetQueryString("order_no");
            id = DTRequest.GetQueryInt("id");
            if (order_no == "")
            {
                JscriptMsg("传输参数不正确！", "back", "Error");
                return;
            }
            if (!new BLL.orders().Exists(order_no))
            {
                JscriptMsg("订单不存在或已被删除！", "back", "Error");
                return;
            }
            if (!Page.IsPostBack)
            {
                ShowInfo(order_no);
            }
        }

        #region 赋值操作=================================
        private void ShowInfo(string _order_no)
        {
            BLL.orders bll = new BLL.orders();
            model = bll.GetModel(_order_no);
            adminModel = GetAdminInfo();
            modelgoods = model.order_goods.FindAll(delegate(Model.order_goods cIndex)
            {
                return cIndex.id == id;
            });
            this.rptList.DataSource = modelgoods; 
            this.rptList.DataBind();
            modeladdress = new BLL.user_address().GetModel(modelgoods[0].address_id);
        }
        #endregion
    }
}